import protocol.XmlParser;


public class XmlTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		String source = "<encabezado><titulo>camilo</titulo><titulo>ortegon</titulo><titulo>barajas</titulo></encabezado>";
		
		int lastIndex = 0;
		String value = XmlParser.readByTag(source, "encabezado", 0);
		System.out.println("encabezado = "+value);
		
		String tag = "titulo";
		value = XmlParser.readByTag(source, tag, lastIndex);
		lastIndex = XmlParser.guessNextLimit(tag, value, lastIndex);
		System.out.println(value);
		System.out.println("lastIndex = "+lastIndex+" substring -> "+source.substring(lastIndex));
		value = XmlParser.readByTag(source, tag, lastIndex);
		lastIndex = XmlParser.guessNextLimit(tag, value, lastIndex);
		System.out.println(value);
		System.out.println("lastIndex = "+lastIndex+" substring -> "+source.substring(lastIndex));
		value = XmlParser.readByTag(source, tag, lastIndex);
		lastIndex = XmlParser.guessNextLimit(tag, value, lastIndex);
		System.out.println(value);
		System.out.println("lastIndex = "+lastIndex+" substring -> "+source.substring(lastIndex));
	}

}
